// pages/search/product/gift/gift.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    giftDatas: [
      {
        giftTopColor: '#2ca9e0',
        giftTopText: '旅盒 1 · 去旅行',
        giftCons: [
          { giftImg: '../../../../images/lx1.jpg', giftText: '旅行手册×1本' },
          { giftImg: '../../../../images/lx2.jpg', giftText: '魔力闪卡×1套' },
          { giftImg: '../../../../images/lx3.jpg', giftText: '特别礼物×1个' },
          { giftImg: '../../../../images/lx4.jpg', giftText: '营养牛奶×6盒' },
          { giftImg: '../../../../images/lx5.jpg', giftText: '毛绒公仔×1个' },
          { giftImg: '../../../../images/lx6.jpg', giftText: '印花贴纸×1张' },
          { giftImg: '../../../../images/lx7.jpg', giftText: '音频故事×1个' },
          { giftImg: '../../../../images/lx8.jpg', giftText: '宝藏地图×1张' }
        ]
      },
       {
        giftTopColor: '#1867A9',
        giftTopText: '旅盒 2 · 去海洋',
        giftCons: [
          { giftImg: '../../../../images/hy1.jpg', giftText: '旅行手册×1本' },
          { giftImg: '../../../../images/hy2.jpg', giftText: '魔力闪卡×1套' },
          { giftImg: '../../../../images/hy3.jpg', giftText: '特别礼物×1个' },
          { giftImg: '../../../../images/hy4.jpg', giftText: '营养牛奶×6盒' },
          { giftImg: '../../../../images/hy5.jpg', giftText: '毛绒公仔×1个' },
          { giftImg: '../../../../images/hy6.jpg', giftText: '印花贴纸×1张' },
          { giftImg: '../../../../images/hy7.jpg', giftText: '音频故事×1个' }
        ]
      },
       {
        giftTopColor: '#4B67A8',
        giftTopText: '旅盒 3 · 去太空',
        giftCons: [
          { giftImg: '../../../../images/tk1.jpg', giftText: '旅行手册×1本' },
          { giftImg: '../../../../images/tk2.jpg', giftText: '魔力闪卡×1套' },
          { giftImg: '../../../../images/tk3.jpg', giftText: '特别礼物×1个' },
          { giftImg: '../../../../images/tk4.jpg', giftText: '营养牛奶×6盒' },
          { giftImg: '../../../../images/tk5.jpg', giftText: '毛绒公仔×1个' },
          { giftImg: '../../../../images/tk6.jpg', giftText: '印花贴纸×1张' },
          { giftImg: '../../../../images/tk7.jpg', giftText: '音频故事×1个' }
        ]
      },
       {
        giftTopColor: '#8B371D',
        giftTopText: '旅盒 4 · 去农场',
        giftCons: [
          { giftImg: '../../../../images/nc1.jpg', giftText: '旅行手册×1本' },
          { giftImg: '../../../../images/nc2.jpg', giftText: '魔力闪卡×1套' },
          { giftImg: '../../../../images/nc3.jpg', giftText: '特别礼物×1个' },
          { giftImg: '../../../../images/nc4.jpg', giftText: '营养牛奶×6盒' },
          { giftImg: '../../../../images/nc5.jpg', giftText: '毛绒公仔×1个' },
          { giftImg: '../../../../images/nc6.png', giftText: '印花贴纸×1张' },
          { giftImg: '../../../../images/nc7.jpg', giftText: '音频故事×1个' }
        ]
      },
       {
        giftTopColor: '#33655C',
        giftTopText: '旅盒 5 · 去森林',
        giftCons: [
          { giftImg: '../../../../images/sl1.jpg', giftText: '旅行手册×1本' },
          { giftImg: '../../../../images/sl2.jpg', giftText: '魔力闪卡×1套' },
          { giftImg: '../../../../images/sl3.jpg', giftText: '特别礼物×1个' },
          { giftImg: '../../../../images/sl4.jpg', giftText: '营养牛奶×6盒' },
          { giftImg: '../../../../images/sl5.jpg', giftText: '毛绒公仔×1个' },
          { giftImg: '../../../../images/sl6.jpg', giftText: '印花贴纸×1张' },
          { giftImg: '../../../../images/sl7.jpg', giftText: '音频故事×1个' }
        ]
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let _this = this;
    if(options.count){
      _this.setData({
        giftData:_this.data.giftDatas.slice(0,options.count),
        index:options.count,
        price:options.price
      })
    }
    wx.getSystemInfo({
      success: function(res) {
        _this.setData({
          height: res.screenHeight,
          width:res.screenWidth
        })
      },
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  toBuy(e){
    wx.navigateTo({
      url: '../order/order?index='+ this.data.index+'&price='+this.data.price,
    })
  }
})